package com.wanmait.recruitment.controller;

import com.wanmait.recruitment.pojo.Nature;
import com.wanmait.recruitment.service.NatureService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("manage/nature")
public class NeTureListController {
    @Resource
    private NatureService natureService;
    @RequestMapping("list")
    public void list(Model model){
        List<Nature> natures = natureService.findAll();
        model.addAttribute("natures",natures);
    }
    @RequestMapping("del")
    @ResponseBody
    public void del(String id){
        natureService.delete(Integer.parseInt(id));
    }
    @RequestMapping("update")
    @ResponseBody
    public void update(Nature nature){
        natureService.update(nature);
    }
    @RequestMapping("insert")
    @ResponseBody
    public void insert(Nature nature){
        natureService.insert(nature);
    }
}
